<template>
  <div class="container">
    <img class="bg-img" src="@/assets/images/xm/bg_login.png" alt="">
    <div class="bg-color"></div>
    <div class="main">
      <div class="main-main">
        <div class="login" v-if="loginState">
          <div class="account" v-if="loginType">
            <input type="text" placeholder="请输入激活码" v-model="keyCode">
          </div>
          <img class="login-on" @click="checkLogin" src="@/assets/images/xm/login.png" alt="">
        </div>
        <div class="bot">
          <div class="mid" @click="toPlay(2)">视频教程</div>
          <div class="mid" @click="toAccount">卡密查询</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {MessageBox} from 'mint-ui'

export default {
  data () {
    return {
      account: '',
      psw: '',
      keyCode: '',
      check: false,
      loginType: true,
      loginIn: false,
      qrCodeUrl: '',
      timer: null,
      uuid: '',
      accountReg: '',
      pswReg: '',
      pswSecondReg: '',
      loginState: true,
      remark: '',
      getQrCodeUrl: 'http://123.129.217.73:9999/api'
      //getQrCodeUrl: 'http://127.0.0.1:9990/api'
    }
  },
  mounted () {

  },
  destroyed () {

  },
  methods: {
    toPlay () {
      window.location.href = 'http://svhqoro.cn/api/video/help.mp4'
    },
    toAccount () {
      this.$router.push('/cdKeyCheck')
    },
    checkLogin () {
      let par = {
        cdKey: this.keyCode
      }
      this.$axios({
        url: this.getQrCodeUrl + '/cdkLogin',
        method: 'get',
        timeout: 20000,
        params: par
      }).then(res => {
        if (res.data.code === 200 && res.data.data.code === 200) {
          localStorage.clear()
          localStorage.setItem('cdKey', this.keyCode)
          localStorage.setItem('session', res.data.data.data.session)
          this.$router.push({
            path: '/loginOn'
          })
        } else {
          MessageBox.alert(`尊敬的用户，${res.data.data.msg}`).then(action => {
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  position: relative;
  width: 750px;

  .bg-color {
    position: fixed;
    width: 750px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    background-color: #A9BFDB;
    z-index: -1;
  }

  .bg-img {
    width: 750px;
  }

  .main {
    position: absolute;
    width: 750px;
    left: 0;
    top: 0;

    .logo {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      top: 190px;
      width: 330px;
      height: 330px;
    }

    .player {
      position: absolute;
      left: 100%;
      transform: translateX(-50%);
      top: 50px;
      width: 100%;
      padding: 0 150px;
      display: flex;
      align-items: center;
      justify-content: space-between;

      div {
        width: 200px;
        height: 60px;

        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        color: #2b0ed4;
        font-weight: 700;
      }
    }

    .main-main {
      position: absolute;
      width: 750px;
      top: 540px;
      padding: 0 60px;

      .login {
        .account, .psw {
          width: 100%;
          height: 100px;
          margin-bottom: 40px;
          position: relative;

          input {
            width: 100%;
            height: 100px;
            background-color: #F7F7FB;
            font-size: 26px;
            color: #151414;
            border: 0;
            margin: 0;
            padding: 0;
            padding: 0 40px;
            border-radius: 10px;

            &::-webkit-input-placeholder {
              color: #bfbfbf;
            }

            &::-moz-placeholder { /* Mozilla Firefox 19+ */
              color: #bfbfbf;
            }

            &:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
              color: #bfbfbf;
            }

            &:-ms-input-placeholder { /* Internet Explorer 10-11 */
              color: #bfbfbf;
            }
          }

          .close, .hide {
            position: absolute;
            right: 40px;
            top: 50%;
            transform: translatey(-50%);
          }

          .close {
            width: 40px;
            height: 40px;
          }

          .hide {
            width: 42px;
            height: 32px;
          }
        }

        .login-on {
          width: 100%;
          height: 100px;
          border-radius: 50px;
          background-color: #fff;
          text-align: center;
          line-height: 100px;
          font-size: 36px;
          color: rgb(39, 113, 209);
          letter-spacing: 8px;
          font-weight: 700;
        }
      }

      .bot {
        padding: 0 40px;
        height: 100px;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .left, .right {
          font-size: 24px;
          color: #2b0ed4;
          font-weight: 700;
        }

        .mid {
          height: 40px;
          line-height: 40px;
          border-radius: 20px;
          padding: 0 20px;
          font-size: 30px;
          font-weight: 500;
          color: #4481FE;
        }
      }
    }
  }

  .mask {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    width: 100%;
    height: 500px;
    background: rgba(0, 0, 0, .5);
    z-index: 10;

    .qr-code {
      position: absolute;

      .qr-bg {
        width: 750px;
        height: 500px;
      }

      .close {
        width: 80px;
        height: 80px;
        position: absolute;
        right: 100px;
        top: 90px;
      }

      .code {
        width: 250px;
        height: 250px;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        top: 500px;

      }
    }
  }
}
</style>
